#include <iostream>
using namespace std;

class Time {
public:
	Time(int h = 0, int m = 0) :hour(h), minute(m) { }

	void show() {
		cout << hour << ":" << minute << endl;
	}

	friend istream & operator>>(istream &in, Time &time);

	Time & operator++();

	Time operator--(int);

private:
	int hour, minute;
};


//int main() {
//	Time noon, now;
//
//	cin >> noon;
//	now = ++noon;
//	noon.show();
//
//	now.show();
//	now = noon--;
//
//	noon.show();
//	now.show();
//	return 0;
//}

istream & operator>>(istream &in, Time &time) {
	in >> time.hour >> time.minute;
	return in;
}

Time & Time::operator++() {
	this->minute++;
	if (this->minute >= 60) {
		this->minute = 0;
		this->hour++;
	}
	if (this->hour >= 24) {
		this->hour = 0;
	}
	return *this;
}

Time Time::operator--(int) {
	Time temp = *this;
	this->minute--;
	if (this->minute <= -1) {
		this->minute = 59;
		this->hour--;
	}
	if (this->hour <= -1) {
		this->hour = 23;
	}
	return temp;
}
